<?php

class StudentareaWebModule extends LinksWebModule {
    protected function initializeForPage() {
        if (!$this->isLoggedIn('eip_parent')) {
            $this->redirectToModule('login', 'login', array('authority' => 'eip_parent') + $this->getArrayForRequest());
        }
        $user = $this->getUser();
        $identity = $user->getAttribute('identity');
        if ($identity <> '學生') {
            $this->unauthorizedAccess();
        }

        $this->addInlineJavascript('var loggedUser = "' . $user->getEmail() . '";');

        parent::initializeForPage();
    }
}
